package com.example.consumer.listeners;

import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
/*
    consumeMode = ConsumeMode.ORDERLY 这种模式下，如果有多个消费者共同消费同一个队列
        内部是加锁，保障多个消费者的串行化消费，从而保证消息的顺序性消费
 */
//@RocketMQMessageListener(topic = "test",consumerGroup = "consumer-group1",consumeMode = ConsumeMode.ORDERLY)
public class RocketMQListener1 implements RocketMQListener<String> {
    @Override
    public void onMessage(String message) {
        System.out.println("RocketMQListener1: " + message);
    }
}
